#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int is_leap_year(int y)
{
	if (((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0))
	{
		return 1;
	}
	else
	{
		return 0;
	}
}

int GetDaysOfYear(int y, int m, int d)
{
	int days[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
	if (is_leap_year(y) && m == 2)
		days[2] += 1;
	int i = 0, sum = 0;
	for (i = 0; i < m; i++)
	{
		sum += days[i];
	}
	return sum+d;
}

int main()
{
	int y = 0, m = 0, d = 0;
	scanf("%d-%d-%d", &y, &m, &d);
	int a = GetDaysOfYear(y, m, d);
	printf("%d", a);
	return 0;
}